Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

punycode.js

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

punycode.js

A robust Punycode converter that fully complies to RFC 3492 and RFC 5891, and works on nearly all JavaScript platforms.

  • 2.3.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.3M
increased by6.5%
Maintainers
2
Weekly downloads
 
Created

What is punycode.js?

punycode.js is a JavaScript library for converting Unicode strings to Punycode and vice versa. Punycode is a way to represent Unicode characters using the limited character subset of ASCII, which is useful for encoding internationalized domain names (IDNs).

What are punycode.js's main functionalities?

Encode Unicode to Punycode

This feature allows you to convert a Unicode string to its Punycode representation. This is useful for encoding internationalized domain names.

const punycode = require('punycode');
const punycodeString = punycode.encode('mañana');
console.log(punycodeString); // 'maana-pta'

Decode Punycode to Unicode

This feature allows you to convert a Punycode string back to its original Unicode representation.

const punycode = require('punycode');
const unicodeString = punycode.decode('maana-pta');
console.log(unicodeString); // 'mañana'

Convert domain name to ASCII

This feature converts a Unicode domain name to its ASCII-compatible encoding, which is necessary for DNS resolution.

const punycode = require('punycode');
const asciiDomain = punycode.toASCII('mañana.com');
console.log(asciiDomain); // 'xn--maana-pta.com'

Convert domain name to Unicode

This feature converts an ASCII-compatible encoded domain name back to its Unicode representation.

const punycode = require('punycode');
const unicodeDomain = punycode.toUnicode('xn--maana-pta.com');
console.log(unicodeDomain); // 'mañana.com'

Other packages similar to punycode.js

Keywords

FAQs

Package last updated on 30 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc